﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace SieveOfEratosthenes_03
{
    class Program
    {
        static void FindPrimes(ArrayList input)
        {
            for(int i = 2; i <= 100;i++)
            {
                for(int j = 0; j < input.Count; j++)
                {
                    if ((int)input[j]!=i&&(int)input[j] % i == 0)
                        input.RemoveAt(j);
                }
            }
        }
        static void Main(string[] args)
        {
            ArrayList array = new ArrayList();
            for (int i = 2; i <= 100; i++)
            {
                array.Add(i);
            }
            Program.FindPrimes(array);
            for(int i = 0; i < array.Count; i++)
            {
                Console.Write(array[i] + " ");
            }
            
        }
    }
}
